require 'win32/registry'

keyname = 'SYSTEM\ControlSet001\Control\Session Manager\Environment'

access = Win32::Registry::KEY_ALL_ACCESS
Win32::Registry::HKEY_LOCAL_MACHINE.open(keyname, access) do |reg|
	pathext = reg['PATHEXT']
	exts = pathext.split(';')
	if not exts.index('.RB') then
		exts.push('.RB')
		reg['PATHEXT'] = exts.join(';')
	end
end

system('assoc .rb=rbfile')
system('ftype rbfile="C:\Tools\ruby-1.8.7-p371\bin\ruby.exe" "%1" %*')

